package com.itheima.springbootwebtlias.mapper;

import com.itheima.springbootwebtlias.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

/*
部门持久层接口，处理部门相关的持久层操作
 */
@Mapper
public interface DeptMapper {

    //查询部门列表
    /*
    @Results(
    {
    @Result(property = "createTime", columu = "create_)
    }
    )
     */

    //查询部门列表
    @Select("select * from dept")
    List<Dept> selectAll();

    //删除部门
    @Delete("delete from dept where id=#{id}")
    void removeById(Integer id);

    //添加部门
    @Insert("insert into dept(id,name,create_time,update_time) " +
            "values(null,#{name},#{createTime},#{updateTime})")
    void saveDept(Dept dept);


    //根据id查询部门
    @Select("select * from dept where id=#{id}")
    Dept selectById(int id);


    //更新修改部门
    @Update("update dept set name=#{name},create_time=#{createTime},update_time=#{updateTime} where id=#{id}")
    void update(Dept dept);
}
